﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace 适配器模式
{

    /// <summary>
    /// 1 适配器模式概述
    /// 2 类适配器模式和对象适配器模式
    /// 3 适配器模式的应用
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {

            WriteLine("**************************************************************");
            IHelper helper = new SqlserverHelper();
            helper.Add<Program>();
            helper.Delete<Program>();
            helper.Update<Program>();
            helper.Query<Program>();

            {
                WriteLine("**************************************************************");
                IHelper oracle = new OracleHelper();
                oracle.Add<Program>();
                oracle.Delete<Program>();
                oracle.Update<Program>();
                oracle.Query<Program>();
            }


            {
                WriteLine("**************************************************************");
                IHelper mysql = new MysqlHelper();
                mysql.Add<Program>();
                mysql.Delete<Program>();
                mysql.Update<Program>();
                mysql.Query<Program>();
            }


            {
                WriteLine("**************************************************************");
                IHelper redis = new RedisHelperClass();
                redis.Add<Program>();
                redis.Delete<Program>();
                redis.Update<Program>();
                redis.Query<Program>();
            }


            {
                WriteLine("**************************************************************");
                RedisHelper redisHelper = new RedisHelper();
                IHelper @object = new RedisHelperObject(redisHelper);
                @object.Add<Program>();
                @object.Delete<Program>();
                @object.Update<Program>();
                @object.Query<Program>();
            }


            Read();
        }
    }
}
